package com.heima.article.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.heima.article.entity.ApArticle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.model.article.dtos.ArticleDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 文章信息表，存储已发布的文章 Mapper 接口
 * </p>
 *
 * @author HM
 * @since 2022-04-29
 */
public interface ApArticleMapper extends BaseMapper<ApArticle> {

    /**
     * 分页条件查询
     * @param ipage
     * @return
     */
    @Select("SELECT * FROM ap_article a , ap_article_content b WHERE a.id = b.article_id")
    List<ArticleDto> findByPage(@Param("ipage") IPage<ApArticle> ipage);
}
